// pages/driver/activityInformation/activityInformation.js
const app = getApp();
var  api = require("../../../api.js");
var WxParse = require('../../../wxParse/wxParse.js');
Page({
    /**
     * 页面的初始数据
     */
    data: {
        activity: []
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        //this.setData({ activity: wx.getStorageSync("activity")[parseInt(options.id)]});
      // 获取优惠券
      if (options.uid) {
        app.shareCouponsMessage(options.uid)
      }
        this.setData({
            id: options.id
        });
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {
        var that = this;
        app.request({
            url: api.article.details,
            method: 'post',
            data: {
                id: that.data.id
            },
            success: function(rs) {
              WxParse.wxParse('article', 'html', rs.data.content, that, 5)
                that.setData({
                    activity: rs.data,
                })
                console.log('公告详情', rs)
            }
        })
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {},
  // 用户分享
  onShareAppMessage: function () {
    let title = app.shareAppMessage().title;
    let imageUrl = app.shareAppMessage().imageUrl;
    let desc = app.shareAppMessage().desc;
    let path = app.shareAppMessage().path;
    console.log(app.shareAppMessage())
    return {
      title: title,
      imageUrl: imageUrl,
      desc: desc,
      path: path,
    }
  },
})